package main

import "fmt"

/*
func swap(x, y string) (string, string) {
	return y, x
}
func main() {
	a, b := swap("lyz", "pjq")
	fmt.Println(a, b)
}

*/

func sum(nums ...int) int {
	var sum1 int
	for i := 0; i < len(nums); i++ {
		sum1 += nums[i]
	}
	return sum1
}

/*
	func fb(n int) int {
		if n == 1 {
			return 1
		}
		if n == 2 {https://www.yuque.com/aceld/mo95lb/dsk886
			return 1
		}
		return fb(n-1) + fb(n-2)
	}
*/
func Out(a int) func(a int) int {
	return func(b int) int {
		return a - b
	}
}

func update(s2 []int) {
	fmt.Println("s2 before", s2)
	s2[0] = 100
	fmt.Println("s2 after", s2)

}
func main() {

	/*
		func1 := Out(10)
		fmt.Println(func1(3))

	*/
	/*
		defer println("1")
		defer println("2")
		defer println("3")
		defer println("4")
		defer println("5")
		//fmt.Println(fb(3))
		//fmt.Println(sum(1, 2, 3, 4, 5))

	*/
	s1 := []int{1, 2, 3, 4}
	fmt.Println("s1 before", s1)
	update(s1)
	fmt.Println("s1 after", s1)
}
